package com.designpatternspart2.structuraldesignpatterns.flyweightpattern;

/**
 *
 * @author Lance
 */
public class FlyweightAdder implements Flyweight
{

    private String operation;

    FlyweightAdder()
    {
        operation = "adding";
        try
        {
            Thread.sleep(3000);
        }
        catch (InterruptedException e)
        {
            e.printStackTrace();
        }
    }

    @Override
    public void doMath(int a, int b)
    {
        System.out.println(getOperation() + " " + a + " and " + b + " : " + (a + b));
    }

    public String getOperation()
    {
        return operation;
    }

    public void setOperation(String operation)
    {
        this.operation = operation;
    }
}
